package logic

import (
	"context"
	"furnipack/furnipackrpc/furnipackrpc"
	"furnipack/furnipackrpc/internal/svc"
	"furnipack/model/mysql"
	"github.com/zeromicro/go-zero/core/logx"
)

type FurnShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewFurnShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *FurnShowLogic {
	return &FurnShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *FurnShowLogic) FurnShow(in *furnipackrpc.FurnShowRequest) (*furnipackrpc.FurnShowResponse, error) {
	// todo: add your logic here and delete this line

	find, err := mysql.FurnFind(mysql.DB, in)
	if err != nil {
		return nil, err
	}
	return &furnipackrpc.FurnShowResponse{
		TitleName: find.TitleName,
		Name:      find.Name,
		TyperName: find.TyperName,
	}, nil
}
